angular.module('myMusic.controllers', [])

	.controller('myMusicCtrl', function($scope, myMuslist) {
		   $scope.blist = [1, 2, 11, 21, 22, 23, 24, 25]
			$scope.arr = []		
			for(var i = 0; i <  $scope.blist.length; i++) {
				$scope.mymusic = 'method=baidu.ting.billboard.billList&type=' +$scope.blist[i]+'&size=3&offset=0';
				myMuslist.music($scope.mymusic).then(function(data) {
					$scope.arr.push(data.data)
//					console.log($scope.arr)
				})
			}		
	})
	.factory('myMuslist', ['$http', function($http) { //请求榜单		
		var musicList = function(ev) {
			return $http.get("/wyy/v1/restserver/ting?" + ev)
				.success(function(res) {
					return res
				})
		};		
		return {
			music: musicList,
		}
	}]);